<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/MasterPage.Master" Inherits="System.Web.Mvc.ViewPage<Animoso.Domain.Album>" %>

<asp:Content ID="Content3" ContentPlaceHolderID="HeadPlaceHolder" runat="server">
<link href="../../uploadify/uploadify.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
    $(document).ready(function() {
        $('#upload').uploadify({
            'uploader': '/uploadify/uploadify.swf',
            'cancelImg': '/uploadify/cancel.png',
            'script': '/Album/Upload',
            'multi': true,
            'onComplete': handleResponse,
            'scriptData': { albumId: '<%=Model.Id %>' },
            'fileDesc': 'JPEG bestanden',
            'fileExt': '*.jpg;*.jpeg'
        });
    });

    function handleResponse(vent, queueID, fileObj, response, data) {
        $('#preview').append("<img src='/Upload/AlbumImages/album_<%=Model.Id %>/" + response + "' />");
    }
</script>
</asp:Content>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Edit
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2>Edit</h2>

    <%= Html.ValidationSummary("Edit was unsuccessful. Please correct the errors and try again.") %>

    <% using (Html.BeginForm("Edit", "Album", FormMethod.Post)) {%>

        <fieldset>
            <legend>Fields</legend>
            <p>
                <label for="Name">Name:</label><br />
                <%= Html.TextBox("Name", Model.Name) %>
                <%= Html.ValidationMessage("Name", "*") %>
            </p>
            <p>
                <label for="Foto">Foto's:</label><br />                
                <a href="javascript:$('#upload').uploadifyUpload();">Foto's Uploaden</a><br /><br />
                <input type="file" name="upload" id="upload" /><br />
                <a href="javascript:$('#upload').uploadifyUpload();">Foto's Uploaden</a>
                <div id="preview"></div>
            </p>                        
            <p>
                <%=Html.Hidden("Id", Model.Id) %>
                <input type="submit" value="Save" />
            </p>
        </fieldset>

    <% } %>

    <div>
        <%=Html.ActionLink("Back to List", "Index") %>
    </div>

</asp:Content>